﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DataAccess.SqlClient;
using System.Data;
namespace DAL
{
   public class NewsDAL
    {
       /// <summary>
       /// 新闻动态显示
       /// </summary>
       /// <returns></returns>
       public static dynamic NewsShow()
       {
           var q = new SqlQuery
           {
               CommandText = "select newsID,ntime,Title,Content from News",
           };
           var dt = SqlDataAccess.ExecDataset(q).Tables[0];//连接数据库，获取新闻动态表
           var list = new List<dynamic>();
           foreach (var dr in dt.Select())
           {
               list.Add(

                   new
                   {
                       newsID = dr.Field<Guid>("newsID"),
                       ntime = dr.Field<DateTime>("ntime").ToString(),
                       Title = dr.Field<string>("Title"),
                       Content = dr.Field<string>("Content"),
                   }
                   );
           }
           return list;
       }
    }
}
